package com.uzai.console.web.pyq;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSort;
import com.uzai.common.enums.DeviceTypeEnum;
import com.uzai.console.annotation.SystemLogType;
import com.uzai.console.dto.pyq.pyqcommenttemplate.PyqCommentTemplateDto;
import com.uzai.console.dto.pyq.pyqcommenttemplate.PyqCommentTemplateIdDto;
import com.uzai.console.dto.pyq.pyqcommenttemplate.PyqCommentTemplateQuery;
import com.uzai.console.entity.PyqCommentTemplate;
import com.uzai.console.enums.OperationTypeEnum;
import com.uzai.console.enums.SystemModelEnum;
import com.uzai.console.mapper.PyqCommentTemplateMapper;
import com.uzai.console.service.pyq.PyqCommentTemplateService;
import com.uzai.console.vo.base.SelectKeyVo;
import com.uzai.console.vo.pyq.pyqcommenttemplate.PyqCommentTemplateVo;
import com.uzai.console.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * 评论模板
 * @author liuqi
 * @date 2021年08月16日 15:11
 */
@Api(value = "评论模板",tags = "个人微信|朋友圈|评论模板")
@ApiSort(30)
@RestController
public class PyqCommentTemplateController extends BaseController {
    private Logger logger = LoggerFactory.getLogger(PyqCommentTemplateController.class);

    @Autowired
    private PyqCommentTemplateService pyqCommentTemplateService;
    @Autowired
    private PyqCommentTemplateMapper pyqCommentTemplateMapper;

    @ApiOperation(value = "分页查询评论模板列表", notes = "分页查询评论模板列表", response = PyqCommentTemplateVo.class)
    @ApiOperationSupport(order = 1)
    @PostMapping("/pyqCommentTemplate/findPyqCommentTemplateList")
    public Object findPyqCommentTemplateList(@RequestBody PyqCommentTemplateQuery pyqCommentTemplateQuery){
        pyqCommentTemplateQuery.setDeviceType(DeviceTypeEnum.DT_PC_WECHAT.getKey());
        return pyqCommentTemplateService.findPyqCommentTemplateList(pyqCommentTemplateQuery);
    }

    @SystemLogType(model = SystemModelEnum.PyqCommentTemplate, type = OperationTypeEnum.ADD)
    @ApiOperation(value = "添加评论模板", notes = "添加评论模板")
    @ApiOperationSupport(order = 2)
    @PostMapping("/pyqCommentTemplate/addPyqCommentTemplate")
    public Object addPyqCommentTemplate(@RequestBody PyqCommentTemplateDto pyqCommentTemplateDto){
        pyqCommentTemplateService.addPyqCommentTemplate(pyqCommentTemplateDto);
        return true;
    }

    @SystemLogType(model = SystemModelEnum.PyqCommentTemplate, type = OperationTypeEnum.UPDATE)
    @ApiOperation(value = "编辑评论模板", notes = "编辑评论模板" )
    @ApiOperationSupport(order = 3)
    @PostMapping("/pyqCommentTemplate/updatePyqCommentTemplate")
    public Object updatePyqCommentTemplate(@RequestBody PyqCommentTemplateDto pyqCommentTemplateDto){
        pyqCommentTemplateService.updatePyqCommentTemplate(pyqCommentTemplateDto);
        return true;
    }

    @SystemLogType(model = SystemModelEnum.PyqCommentTemplate, type = OperationTypeEnum.DELETE)
    @ApiOperation(value = "删除", notes = "删除")
    @ApiOperationSupport(order = 4)
    @PostMapping("/pyqCommentTemplate/deletePyqCommentTemplate")
    public Object deletePyqCommentTemplate(@RequestBody PyqCommentTemplateIdDto pyqCommentTemplateIdDto){
        pyqCommentTemplateService.deletePyqCommentTemplate(pyqCommentTemplateIdDto);
        return true;
    }

    @ApiOperation(value = "查询评论模板详情", notes = "查询评论模板详情", response = PyqCommentTemplateVo.class)
    @ApiOperationSupport(order = 5)
    @PostMapping("/pyqCommentTemplate/findPyqCommentTemplate")
    public Object findPyqCommentTemplate(@RequestBody PyqCommentTemplateIdDto pyqCommentTemplateIdDto){
        return pyqCommentTemplateService.findPyqCommentTemplate(pyqCommentTemplateIdDto);
    }

    @ApiOperation(value = "查询所有评论模板下拉列表", notes = "查询所有评论模板下拉列表", response = PyqCommentTemplateVo.class)
    @ApiOperationSupport(order = 6)
    @PostMapping("/pyqCommentTemplate/findSelectList")
    public Object findSelectList(@RequestBody PyqCommentTemplateQuery pyqCommentTemplateQuery){
        pyqCommentTemplateQuery.setDeviceType(DeviceTypeEnum.DT_PC_WECHAT.getKey());
        return pyqCommentTemplateService.findSelectList(pyqCommentTemplateQuery);
    }

}
